//
//  BodyMainGV.swift
//  demo01
//
//  Created by babybus on 2025/7/7.
//
import Foundation
import UIKit
import SnapKit
import Alamofire

class BodyMainGVView:UIView{
    //全局变量
    private var checkInButton:BodyGVButton = BodyGVButton()
    private var achievementImg:UIImageView = UIImageView(image: UIImage(named: "achievementTask"))
    private var upLevel:UpLevelGVView = UpLevelGVView()
    private var topOfBody:TopOfBodyGVView = TopOfBodyGVView()
    
    //初始化方法
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
        setCheckInButton()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setupUI(){
        topOfBody.delegateLevel = upLevel
        
        self.addSubview(topOfBody)
        self.addSubview(upLevel)
        self.addSubview(checkInButton)
        self.addSubview(achievementImg)
        topOfBody.snp.makeConstraints { make in
            make.width.equalToSuperview()
            make.height.equalTo(204)
            make.top.equalToSuperview()
        }
        upLevel.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.width.equalToSuperview()
            make.height.equalTo(74)
            make.bottom.equalToSuperview().inset(84)
        }
        checkInButton.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.width.equalTo(183)
            make.height.equalTo(70)
            make.bottom.equalToSuperview().inset(8)
        }
        achievementImg.snp.makeConstraints { make in
            make.width.equalTo(70)
            make.height.equalTo(54)
            make.left.equalToSuperview().inset(12)
            make.bottom.equalToSuperview().inset(24)
        }
    }
    func setCheckInButton(){
        checkInButton.setImage(UIImage(named: "checkIn"), for: .normal)
    }
}
